import axios from 'axios'
import baseUrl from '@/baseUrl'
import Header from '@/components/header/header.vue'
import mTitle from '@/components/mtitle/mtitle.vue'
// import mContent from '@/components/mainContent/mainContent'
export default {
  name: 'appStore',
  created () {
    this.getDataList()
  },
  methods: {
    getDataList () {
      axios.get(`${baseUrl}/${this.$route.name}`)
        .then((res) => {
          console.log(this.$route.params.title, 'aaaaaaaa')
          this.datalist = res.data
        })
    }
  },
  components: {
    Header,
    mTitle
    // mContent
  },
  computed: {
    routeData () {
      if (this.$route.params.title === 'cyyy') {
        return this.datalist.sort(function (a, b) {
          return b.count * 1 - a.count * 1
        })
      } else {
        return this.datalist.sort(function (a, b) {
          return a.dateTime < b.dateTime ? 1 : -1
        })
      }
    }
  },
  data () {
    return {
      datalist: [],
      leftTitle: {
        bigTitle: '推荐应用',
        smallTitle: [{
          route: '/appStore/cyyy',
          routeTitle: '常用应用'
        }, {
          route: '/appStore/zjsy',
          routeTitle: '最近使用'
        }]
      }
    }
  }
}
